package cn.tedu;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Scanner;

public class Demo06 {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
            System.out.println("请输入英雄名");
            String name = scan.nextLine();
            System.out.println("请输入价格");
            int money = scan.nextInt();
            sqlOperate(name,money);
    }
    public  static void sqlOperate(String name,int money){
        try(
                Connection conn = DBUtils.getConn()
        ) {
            Statement s = conn.createStatement();
            s.executeUpdate("insert into hero(name,money) values('"+name+"',"+money+")");
            System.out.println("执行完毕!!!");
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
